# 定义函数，接受歌手名和专辑名以及歌曲数的默认值
def make_album(singer_name,album_name,num_song = None):
    """
    音乐专辑
    :param singer_name: 歌手名
    :param album_name: 专辑名
    :param num_song: 歌曲数
    :return: 包含这些信息的字典
    """
    album = {'s_name': singer_name, 'a_name': album_name, }
    if num_song:
        album['n_song'] = num_song
    return album
# 使用while循环持续获得用户输入
while True:
    print("请告诉我专辑名，歌手名，歌曲数（可不填）")
    print("完成后输入'q'退出")

    singer_name = input("歌手名：" )
    if singer_name == 'q':
        break

    album_name = input("专辑名：" )
    if album_name == 'q':
        break

    num_song = input("歌曲数(可跳过)：" )
    if num_song == 'q':
        album = make_album(singer_name, album_name,)
        print(album)
        break
    else:
        album = make_album(singer_name,album_name,num_song)
        print(album)



